<?php
use Carbon\Carbon;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class AuthorityController extends BaseController
{
    protected $layout = 'layouts.base';
    /**
     * get login
     * @return Response
     */
    public function getSignin()
    {
        $this->layout->content =  View::make('authority.signin');
    }
    
		/**
     * post login
     * @return Response
     */
    public function postSignin()
    {
        $credentials = array('account'=>Input::get('username'), 'password'=>Input::get('password'));
        if (Auth::attempt($credentials, true)) {
            // 登录成功，跳回之前被拦截的页面
								
            return Redirect::intended('admins');
        } else {
            // 登录失败，跳回
            return Redirect::back()
                ->withInput()
                ->withErrors(array('attempt' => '“账号”或“密码”错误，请重新登录。'));
        }
    }

			/**
     * process logout
     * @return Response
     */
    public function getLogout()
    {
        Auth::logout();
        return Redirect::route('signin');
    }

}
